#include "optionedit.h"
#include "ui_optionedit.h"
#include <QDebug>

OptionEdit::OptionEdit(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::OptionEdit)
{
    ui->setupUi(this);

}
void OptionEdit::update(Option option){
    ui->image->showURLImage(option.pic);
    ui->name->setText(option.name);
    ui->amount->setText(QString::number(option.amount));
    ui->driection->setText(option.direction==1?"入":"出");
    connect(ui->confirm,&QToolButton::clicked,[=](){
        emit confirm(ui->amount->text().toLong());
        this->close();
    });
    connect(ui->cancel,&QToolButton::clicked,[=](){
        this->close();
    });
//    ui->amount->setDiable(false,true);
    this->adjustSize();
}
OptionEdit::~OptionEdit()
{
    delete ui;
}
